<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <style>
        .nav-bar {
            position: fixed;
            left: -200px; /* 默认隐藏 */
            top: 0;
            width: 200px;
            height: 100vh;
            background-color: #f0f0f0;
            transition: left 0.3s ease;
            z-index: 1000;
        }

        .nav-bar.show {
            left: 0;
        }

        .toggle-btn {
            position: fixed;
            left: 10px;
            top: 10px;
            z-index: 1001;
        }

        .nav-bar ul {
            list-style-type: none;
            padding: 0;
            margin: 0;
        }

        .nav-bar li {
            text-align: center;
            padding: 10px;
        }

        .nav-bar li a {
            text-decoration: none;
            color: #333;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <div class="nav-bar" id="navBar">
        <ul>
            <li><a href="#">首页</a></li>
            <li><a href="/addword">添加单词</a></li>
            <!-- 可以根据需要添加更多导航项 -->
        </ul>
    </div>
    <button class="toggle-btn" id="toggleBtn">显示/隐藏</button>

    <script>
        const navBar = document.getElementById('navBar');
        const toggleBtn = document.getElementById('toggleBtn');

        toggleBtn.addEventListener('click', function() {
            navBar.classList.toggle('show');
        });
    </script>
</body>
</html>